//
//  RBGoodsOrderReundSubmitVC.m
//  zhongzhenglu
//
//  Created by XL on 2022/8/16.
//

#import "RBGoodsOrderReundSubmitVC.h"
#import "RBDefine.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RanTool.h"
#import "RBTextView.h"
#import "RBGrowablePhotoContainer.h"

@interface RBGoodsOrderReundSubmitVC ()

@property(nonatomic, strong)UIScrollView *scrollView;
@property(nonatomic, strong)UILabel *submitBtn;

@property(nonatomic, strong)UILabel *reasonL;

@end

@implementation RBGoodsOrderReundSubmitVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
}

#pragma mark - Private

- (void)setup
{
    self.title = @"退款申请";
    self.view.backgroundColor = [RBThemeConfig bgGrayColor];
    
    [self.scrollView rbSetContentWidth:kRBMainScreenWidth];
    [self.scrollView addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view view_addView:({
            UIView *view = UIView.new;
            [view rbAddTapGesWithTarget:self action:@selector(reasonViewTapped)];
            [view setResponseArea:UIEdgeInsetsMake(Zoom(12), 0, Zoom(12), 0)];
            
            UILabel *titleL = [RanTool labelWithFontSize:Zoom(14) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:@"退款原因"];
            [view addSubview:titleL];
            [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(Zoom(17));
                make.top.bottom.mas_equalTo(0);
            }];
            
            UIImageView *imgView = [RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"];
            [view addSubview:imgView];
            [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.mas_equalTo(-Zoom(11));
                make.width.mas_equalTo(Zoom(7));
                make.top.bottom.mas_equalTo(0);
            }];
            
            UILabel *desL = [RanTool labelWithFontSize:Zoom(14) weight:1 color:[RBThemeConfig textGrayColor] align:2 text:@"请选择退款原因"];
            self.reasonL = desL;
            [view addSubview:desL];
            [desL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.bottom.mas_equalTo(0);
                make.width.mas_equalTo(Zoom(200));
                make.right.mas_equalTo(imgView.mas_left).offset(Zoom(-7));
            }];
            
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(25) bottom:0 left:0 right:0 centerX:0];
        [view view_addView:({
            UIView *view = UIView.new;
            
            UILabel *titleL = [RanTool labelWithFontSize:Zoom(14) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:@"退款金额"];
            [view addSubview:titleL];
            [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(Zoom(17));
                make.top.bottom.mas_equalTo(0);
            }];
            
            UILabel *desL = UILabel.new;
            desL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
                [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(11)] color:[RBThemeConfig priceRedColor] string:@"￥"];
                [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(16)] color:[RBThemeConfig priceRedColor] string:@"2344.00"];
            }];
            [view addSubview:desL];
            [desL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.bottom.mas_equalTo(0);
                make.right.mas_equalTo(Zoom(-11));
            }];
            
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(40) bottom:Zoom(25) left:0 right:0 centerX:0];
        
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(10) bottom:0 left:Zoom(13) right:Zoom(13) centerX:0];
    
    [self.scrollView addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view view_addView:[RanTool labelWithFontSize:Zoom(14) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:@"补充描述"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(25) bottom:0 left:Zoom(16) right:0 centerX:0];
        [view view_addView:({
            RBTextView *textView = RBTextView.new;
            textView.font = [UIFont systemFontOfSize:Zoom(14)];
            textView.textColor = [RBThemeConfig textBlackColor];
            textView.placeHolder = @"请填写详细退款描述，方便商家通过";
            textView.placeHolderColor = [UIColor colorWithHexString:@"#A2A2A2"];
            textView.placeHolderFontSize = Zoom(14);
            textView;
        }) withHeight:Zoom(60) width:CGFLOAT_MIN top:Zoom(14) bottom:Zoom(25) left:Zoom(16)-3 right:Zoom(16)-3 centerX:0];
        
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(10) bottom:0 left:Zoom(13) right:Zoom(13) centerX:0];
    
    [self.scrollView addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view view_addView:[RanTool labelWithFontSize:Zoom(14) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:@"补充照片"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(25) bottom:0 left:Zoom(16) right:0 centerX:0];
        
        CGFloat photoW = Zoom(264);
        RBGrowablePhotoContainer *photoView = [RBGrowablePhotoContainer viewWithMaxNum:9 colNum:3 editable:YES viewWidth:photoW];
        [view view_addView:photoView withHeight:photoView.viewHeight width:photoW top:Zoom(14) bottom:Zoom(25) left:Zoom(16) right:CGFLOAT_MIN centerX:0];
        
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(10) bottom:0 left:Zoom(13) right:Zoom(13) centerX:0];
}

#pragma mark - Network

#pragma mark - Event

- (void)reasonViewTapped
{
    NSLog(@"reasonViewTapped");
}

- (void)submitBtnTapped
{
    
}

#pragma mark - Setter

#pragma mark - Getter

- (UIScrollView *)scrollView
{
    if (!_scrollView)
    {
        self.scrollView = ({
            UIScrollView *view = UIScrollView.new;
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.top.mas_equalTo(0);
                make.bottom.mas_equalTo(self.submitBtn.mas_top).offset(-Zoom(12));
            }];
            view;
        });
    }
    return _scrollView;
}

- (UILabel *)submitBtn
{
    if (!_submitBtn)
    {
        self.submitBtn = ({
            UILabel *view = [RanTool labelWithFontSize:Zoom(15) weight:1 color:UIColor.whiteColor align:1 text:@"立即提交" bgColor:[RBThemeConfig buttonBlueColor] radius:Zoom(22)];
            [view rbAddTapGesWithTarget:self action:@selector(submitBtnTapped)];
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerX.mas_equalTo(0);
                make.bottom.mas_equalTo(-MAX(Zoom(27), kRBSafeBottomHeight));
                make.height.mas_equalTo(Zoom(44));
                make.width.mas_equalTo(Zoom(340));
            }];
            view;
        });
    }
    return _submitBtn;
}

@end
